<?php
/**
 * 首页--接口
 */

namespace app\frontend\controllers\homepage;

use App\common\components\BaseController;

class HomePageController extends BaseController
{

    public function index()
    {
        $pluginId = request()->input('platform_id', 0);

        $data = [
            'id' => $pluginId
        ];
        return successJson('ok', $data);
    }

    /**
     * 首页头部接口
     *
     * @return \Illuminate\Http\JsonResponse
     */
    public function homePageTop()
    {
        //获取数据
        $data = self::getData('HomePage', 'homePageTop');
        return successJson('ok', $data);
    }

    /**
     * 爆款推荐
     * @return \Illuminate\Http\JsonResponse
     */
    public function hotGoods()
    {
        //获取数据
        $data = self::getData('HomePage', 'hotGoods');
        return successJson('ok', $data);
    }

    /**
     * 搜索商品
     * @return \Illuminate\Http\JsonResponse
     */
    public function searchGoods()
    {
        //搜索内容
        $search = request()->input('search', 0);
        //获取数据
        $data = self::getData('HomePage', 'searchGoods');
        return successJson('ok', $data);
    }

    /**
     * 热门搜索记录
     * @return \Illuminate\Http\JsonResponse
     */
    public function hotSearch()
    {
        //获取数据
        $data = self::getData('HomePage', 'hotSearch');
        return successJson('ok', $data);
    }

    /**
     * 搜索的历史记录
     * @return \Illuminate\Http\JsonResponse
     */
    public function searchHistory()
    {
        //获取数据
        $data = self::getData('HomePage', 'searchHistory');
        return successJson('ok', $data);
    }


}

